<template>
  <view class="page-goods-home">
    <view class="title">
      <view @tap="toPage(1)">登陆</view>
      <view @tap="toPage(0)">注册</view>
    </view>
    <scroll-view scroll-y class="scroll-view">
      <view class="scroll-view-item"
            v-for="(item, i) in dataList" :key="i">
        <image :src="item.img"></image>
        <view>￥{{ item.title }}</view>
        <view>￥{{ item.money }}</view>
      </view>
    </scroll-view>
  </view>
</template>

<script>
export default {
  name: "goodsHome",
  data() {
    return {
      dataList: [
        {
          title: '九阳真空封口机食品包装机抽真空密封机小型家用塑封机保鲜机商用',
          money: '139.0',
          img: require('@/static/img/goodsHome/1.png'),
        }, {
          title: '维达手帕纸超韧4层8张X18包卫生纸巾 自然无香餐巾纸新旧交替发货',
          money: '9.9',
          img: require('@/static/img/goodsHome/2.png'),
        }, {
          title: '芭芭农场专用兑换品 广西武鸣沃柑3斤装 有问题请咨询客服',
          money: '11.6',
          img: require('@/static/img/goodsHome/3.png'),
        }, {
          title: 'la有氧洗威露士抗菌洗衣液松木2斤手洗除菌去渍新旧包装随机发',
          money: '29.5',
          img: require('@/static/img/goodsHome/4.png'),
        }, {
          title: '新货【三只松鼠_罐装开心果500g】坚果孕妇零食原色1斤装干果特产',
          money: '79.9',
          img: require('@/static/img/goodsHome/5.png'),
        }, {
          title: '良品铺子酥脆薄饼干300g早餐代餐充饥零食海苔咸味休闲小吃',
          money: '24.9',
          img: require('@/static/img/goodsHome/6.png'),
        },{
          title: '九阳真空封口机食品包装机抽真空密封机小型家用塑封机保鲜机商用',
          money: '139.0',
          img: require('@/static/img/goodsHome/1.png'),
        }, {
          title: '维达手帕纸超韧4层8张X18包卫生纸巾 自然无香餐巾纸新旧交替发货',
          money: '9.9',
          img: require('@/static/img/goodsHome/2.png'),
        }, {
          title: '芭芭农场专用兑换品 广西武鸣沃柑3斤装 有问题请咨询客服',
          money: '11.6',
          img: require('@/static/img/goodsHome/3.png'),
        }, {
          title: 'la有氧洗威露士抗菌洗衣液松木2斤手洗除菌去渍新旧包装随机发',
          money: '29.5',
          img: require('@/static/img/goodsHome/4.png'),
        }, {
          title: '新货【三只松鼠_罐装开心果500g】坚果孕妇零食原色1斤装干果特产',
          money: '79.9',
          img: require('@/static/img/goodsHome/5.png'),
        }, {
          title: '良品铺子酥脆薄饼干300g早餐代餐充饥零食海苔咸味休闲小吃',
          money: '24.9',
          img: require('@/static/img/goodsHome/6.png'),
        },
      ]
    }
  },
  methods: {
    toPage(id) {
      let url = id ? '/pages/login/login' : '/pages/reg/reg';
      uni.navigateTo({
        url
      });
    },
  }
}
</script>

<style scoped lang="less">
.page-goods-home {
  width: 100%;
  font-size: 16upx;
  line-height: 36upx;

  .title {
    display: flex;

    view {
      padding: 20upx;
    }
  }

  ::v-deep .scroll-view {
    .uni-scroll-view-content {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
    }

    .scroll-view-item {
      width: 48%;
      padding: 20upx;
      border-radius: 10upx;
      border: 1px solid #eeeeee;
      box-sizing: border-box;
      margin: 0 auto;
      margin-bottom: 20upx;
      text-align: left;

      image {
        display: block;
        width: 316upx;
        height: 316upx;
      }

      view {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
        text-overflow: ellipsis;

        &:last-of-type {
          font-weight: bold;
          color: red;
        }
      }
    }
  }
}
</style>
